package ooday02;

//老师,私有属性薪水
public class Teacher extends Person {
    private double salary;

    public Teacher(String name, int age, String address, double salary) {
        super(name, age, address);
        this.salary = salary;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    void teach(Person p) {
        System.out.println(this.getName() + "正在给" + p.getName() + "讲课...");
    }

    @Override
    public void sayHi() {
        System.out.println("大家好，我叫" + this.getName() + "，今年" + this.getAge() + "岁了，家住" +
                this.getAddress() + "，工资为:" + this.getSalary());
    }
}
